﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmartHouseOOP
{
    public class Device
    {
        private string name;
        private bool deviceStatus;
        private Resource currentResource;
        public Device(string inputName, string inputResourceLabel)
        {
            this.name = inputName;
            this.currentResource = new Resource(inputResourceLabel);
            this.deviceStatus = false;
        }
        public void TurnOn()
        {
            this.deviceStatus = true;
        }
        public void TurnOff()
        {
            this.deviceStatus = false;
        }
        public float GetConsumedResource(int t)
        {
            float sum = 0;
            //обработка данных
            return sum;
        }
        public string ResourceLabel
        
        {
            get
            {
                return currentResource.ResourceLabel;
            }
        }

        public override string ToString()
        {
            string statusString=string.Empty;
            statusString += "Device name:" + name+"\n";
            if (deviceStatus)
            {
                statusString += "Device status: On" + "\n";
            }
            else statusString += "Device status: Off" + "\n";

            statusString += name+" uses "+ currentResource.ToString() + "\n\n";

            return statusString;

        }
        public string Name
        {
            get
            {
                return this.name;
            }
        }

    }
}
